package day07;

import java.util.Scanner;

public class CalAirPrice {
    public static void main(String[] args) {
        System.out.println("输入原价");
        Scanner scan=new Scanner(System.in);
        double money=scan.nextDouble();
        System.out.println("请输入月份");
        int month=scan.nextInt();
        System.out.println("1.头等舱 2.商务舱 3.经济舱");
        int c=scan.nextInt();
        double airmoney=price(month,c,money);
        if(airmoney>0){
            System.out.println("最终价格为："+airmoney);
        }

    }
    public static double price(int mouth,int c,double money){
        if(mouth>12||mouth<1){
            System.out.println("错误");
            return -1;
        }
        if (c>3||c<1){
            System.out.println("错误");
            return -1;
        }
        if(mouth>4&&mouth<11){
            switch (c) {
                case 1:
                    money *= 0.9;
                    break;
                case 2:
                    money *= 0.85;
                    break;
                case 3:
                    money *= 0.8;
                    break;
                default:
                    System.out.println("输入错误");
            }
        }else {
            switch (c) {
                case 1:
                    money *= 0.7;
                    break;
                case 2:
                    money *= 0.65;
                    break;
                case 3:
                    money *= 0.6;
                    break;
                default:
                    System.out.println("输入错误");
        }
        }return money;
    }
}